tsteven4 [Fri, 15 May 2020 15:04:10 +0000 (09:04 -0600)]
update shapelib to 1.5.0. (#559)
tsteven4 [Thu, 14 May 2020 17:19:24 +0000 (11:19 -0600)]
convert dg100 to Format class (#557)
* convert dg100 format to Format class.
* regenerate dependencies for dg100 format.
* whitespace
tsteven4 [Wed, 13 May 2020 15:01:50 +0000 (09:01 -0600)]
use qdatetime for dg100 format (#556)
* use QDateTime for dg-100 format.
* fix undefined behavior bug in dg100.
When sending the getconfig command memcpy would be invoked with
src == nullptr. The behavior of memcpy is undefined under these conditions,
even if the count is zero as it is in this case.
tsteven4 [Wed, 13 May 2020 13:22:58 +0000 (07:22 -0600)]
Add regression test capability for DG100/DG200 format. (#554)
* add regression test cabability for dg100 format.
The test compares any written data with the subsequent bytes in the
reference file. The test supplies any read data from the subsequent
bytes in the reference file.
A reference file can be created from the debug output at level 5
when reading an actual globalsat device:
egrep 'Receiving|Sent' "$log" | sed 's/^Sent: //' | sed 's/^Receiving //' \
| sed 's/RX:.*//' | xxd -r -p > "$log".bin
This creates a binary file from all the bytes transferred to or
from the device.
* update serialization reference files.
Even though the dg100 regression formats are internal, they still
get serialized. The GUI ignores them.
* Fix memory leak exposed by new dg100 regression test.
By using QList instead of homegrown dynarray16 class.
tsteven4 [Thu, 7 May 2020 12:31:39 +0000 (06:31 -0600)]
fix nmea writer date bug. (#553)
* fix nmea writer date bug.
dates before 2000 were written with a month off by one.
This also changes the behavior when the creation time is invalid.
Previously you would get data related to the unix epoch for the date
and time fields.
Now you get empty fields, i.e. ",,"
* fix magellan writer date bug.
This had the same bug as nmea. It had an additional bug
when it attempted to round the fractional part of a second. Rounding
can ripple all the way from the fractional part of a second to the year,
as is now demonstrated in the testcase.
Like nmea, magellan will now print empty fields if the creation time
is invalid.
* fix date bug in gpssim.
This is the same bug as in nmea, magproto.
tsteven4 [Mon, 4 May 2020 19:20:22 +0000 (13:20 -0600)]
convert unicsv to Format class (#552)
* convert unicsv to Format class.
Two bugs are fixed as well:
1. { "datum", fld_date, STR_ANY } is removed from the fields_def.
Note that the type is fld_date. I don't think this was ever used.
We do have the datum option to set the datum from the command line.
2. unicsv_fondle_header changed the fields_def type to fld_iso_time
if it was fld_time or fld_date and the value contained "iso".
However, fields_def isn't used outside unicsv_fondle_header, so
this had no effect.
* update dependencies.
tsteven4 [Fri, 1 May 2020 22:12:29 +0000 (16:12 -0600)]
fix windows issues with kml.h including windows.h (#551)
windows.h defines macros for max and min, which lead to compiler
warnings:
random.h(125): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file
kml hasn't needed windows.h since
ea82fa6d6
tsteven4 [Fri, 1 May 2020 13:03:31 +0000 (07:03 -0600)]
convert kml to Format class (#550)
* convert kml to Format class.
* update dependencies.
* restore kml real time postion writer functionality.
and have it produce valid kml.
Add a test case.
* correct new kml test reference file name.
tsteven4 [Fri, 1 May 2020 12:32:18 +0000 (06:32 -0600)]
add recoverymode and CRC checking to FIT reader. (#549)
* add recoverymode and CRC checking to FIT reader.
If present, the header CRC is checked.
The file CRC and length is checked.
A recoverymode option is added.
In the default mode we will fatal with:
a bad CRC,
a bad endian field,
an attempt to read when the data section doesn't have sufficient data,
an unexepected EOF.
In recovery mode when we encounter one of these errors we will abort
read processing and continue. This allows a more immediate cleaner
exit from the reader while still allowing any writer to use data that
was recovered previous to the read abort.
* add further explanation of recoverymode for document.
* make sure garmin fit messages are defined before being used.
tsteven4 [Tue, 28 Apr 2020 12:46:14 +0000 (06:46 -0600)]
sprintf/snprintf replacements (#548)
* fix g++ 9.3 warnings about snprintf.
These appear at -O2.
* handle garmin category conversion similar to garmin_fs.cc
* fix stmwpp includes under configure.
tsteven4 [Tue, 28 Apr 2020 12:42:48 +0000 (06:42 -0600)]
introduce xasprintf that accepts a QScopedPointer& (#547)
and use it to fix gcc 9 warnings in magproto, as well as other
possible string truncations/overflows.
tsteven4 [Fri, 24 Apr 2020 15:48:42 +0000 (09:48 -0600)]
migrate advanced travis build to focal. (#546)
and fix a new clazy warning. This warning shows up on focal
with clazy 1.6, but not on eoan with clazy 1.5.
tsteven4 [Tue, 21 Apr 2020 20:38:47 +0000 (14:38 -0600)]
convert garmin_fit to Format class. (#544)
Additionally, modernize fit reader:
use a container to hold field information for a message.
pass fit fields and message defs by const reference.
tsteven4 [Tue, 21 Apr 2020 00:32:02 +0000 (18:32 -0600)]
add missing include file to build.
tsteven4 [Sun, 19 Apr 2020 20:44:43 +0000 (14:44 -0600)]
improve MSVC 2015 workaround. (#543)
tsteven4 [Sat, 18 Apr 2020 12:34:39 +0000 (06:34 -0600)]
convert subrip, energympro, globalsat_sport to Format class (#542)
* convert subrip, energympro, globalsat_sport to Format.
* update dependencies in Makefile
tsteven4 [Sat, 18 Apr 2020 12:17:27 +0000 (06:17 -0600)]
update linux/macos CI Qt 5.12.8 (#541)
* update CI to 5.12.8 (except appveyor)
we use the appveyor installed Qt 5.12, which is currently
5.12.6.
* update travis yaml syntax.
* update macos build system for Qt 5.12 build.
* try osx_image: xcode11.3
osx_image xcode10.3 failed 3 times in a row. It showed an
incomplete Qt install and repeated attempts to detatch.
* debug macos qt install fails
* Revert "debug macos qt install fails"
This reverts commit
36df50bc865b515b4545f5f25cc65f5e0575d325.
* Revert "try osx_image: xcode11.3"
This reverts commit
ff1e803234b31671e77d8d9ca68e74d62e753b80.
* Revert "update macos build system for Qt 5.12 build."
This reverts commit
efedf5132a84141ae351cfe308433bfbda53374b.
* cleanup new docker script.
* build docker image in clean directory.
* move macos Qt 5.12 build to xcode 10.3.
This includes a workaround for a bug in the Qt intaller
that causes segmentation faults in the Qt installer when
the minimal platform is used on macos 10.14, 10.15.
tsteven4 [Fri, 17 Apr 2020 12:28:34 +0000 (06:28 -0600)]
assume energympro and globalsatsport use LocalTime. (#447)
* assume energympro and globalsatsport use LocalTime.
add an option to set the timezone for these formats, as the
timezone used to create the data may not match the timezone of the
computer reading the data.
* modify energympro/globalsatsport tests to use
UTC offsets. Europe/Stockholm wasn't available on our Docker
bionic test image.
* util.cc build fix
include QTimeZone, dropped in manual merge
* Fix build error in util.cc
Lazy conflict merging.
* modify serialization ref files for new option.
* make new var static in energympro.
Co-authored-by: GPSBabel <gpsbabel@users.noreply.github.com>
Pierre Bernard [Fri, 17 Apr 2020 12:17:18 +0000 (14:17 +0200)]
Added support for Qstarz BL-1000 .BIN files (#515)
* Added support for Qstarz BL-1000 .BIN files
* Use FormatSpecificData
* Updates based on pull request comments
* Remove executable bit on Qstarz sample file
* include-what-you-use headers
* Added format documentation for qstarz_bl_1000
Co-authored-by: gloubibou <pierre.bernard@web.de>
tsteven4 [Thu, 16 Apr 2020 22:06:03 +0000 (16:06 -0600)]
A variety of loose ends (#540)
* misc cleanups.
clang-tidy found the Qstring passed by value.
Attempting to build the GUI without webengine or webkit with Qt 5.15
found the missing QT module (widgets) in app.pro. It is required by QDialog.
* fiddle with document recipes.
add qmake target to generate gpsbabel.pdf.
drop --load-trace xsltproc options when building document.
set logging level for fop to WARN
by creating $HOME/.foprc if it doesn't exist.
fop doens't have the ability to override this on the command line.
* use .foprc in build tree.
This solves the issue on travis the $HOME doesn't exist.
It also avoids writing to the users home directory.
* fiddle with configure.
* filter with doc version stuff.
tsteven4 [Wed, 15 Apr 2020 13:59:39 +0000 (07:59 -0600)]
Fallthrough corrections (#538)
* fix an actual bug found by Wimplicit-fallthrough=
* add comments for gcc wrt Wimplicit-fallthrough=
The real fix is the to add the attribute [[fallthrough]];
which was added in c++17.
gcc accepts this, but until c++17 there wasn't
a requirement to ignore unrecognized attributes, so we can
imagine a pre c++17 compiler might choke on it.
tsteven4 [Tue, 14 Apr 2020 21:33:19 +0000 (15:33 -0600)]
Fix access to QByteArray/QString outside the valid range. (#537)
With Qt 5.15, and likely 5.14, the following warnings were generated during
testo:
Using QByteRef with an index pointing outside the valid range of a QByteArray. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
Note this requires Qt to be compiled for debug.
These warnings can be debugged by running testo with
"export QT_FATAL_WARNINGS=1" to generate core dumps.
I suspect the appending of null terminators in ggv_bin is unecessary,
i.e. I beleive QByteArray::resize() in ggv_bin_read_bytes will take
care of this. Never the less I slavishly kept adding them just to make
certain.
tsteven4 [Mon, 13 Apr 2020 14:36:32 +0000 (08:36 -0600)]
rework subrip format synchronization. (#536)
* rework subrip format synchronization.
support subsecond synchronization.
validate option input.
add debug messages for synchronization.
correct option text for GUI.
* update serialization reference files for corrected subrip help.
tsteven4 [Mon, 13 Apr 2020 14:27:57 +0000 (08:27 -0600)]
Generalize xmlgeneric callbacks (#532)
generalize callbacks for xmlgeneric.
use newly available pointer to data member callbacks to restore
yahoo functionality.
add a yahoo test.
.
add xml_init method to automatically generate Functors.
tsteven4 [Wed, 8 Apr 2020 12:20:52 +0000 (06:20 -0600)]
improve kml reader speed 5.1x. (#531)
tsteven4 [Sun, 5 Apr 2020 22:31:23 +0000 (16:31 -0600)]
Optimize QString usage in gpx format. (#530)
Don't convert QStringRef to QString unecessarily.
Use QLatin1String, QStringLiteral.
A 18% performance improvement has been measured with
gpxbabel -f lowrance-v4.gpx -o lowranceusr,wversion=4 -F lowrance-v4.usr
valgrind --tool=callgrind was useful. Further improvements in the
reader are likely to be found in xml_parse_time.
tsteven4 [Fri, 3 Apr 2020 21:41:40 +0000 (15:41 -0600)]
Lowranceformat (#529)
* convert lowranceusr format to Format class.
* fix lowranceusr linking issues on some platforms.
* workaround MSVC2015 C2373 errors with constexpr static arrays.
* try harder to work around MSVC2015 C2373.
* tweak lowrancusr
tsteven4 [Tue, 31 Mar 2020 22:40:22 +0000 (16:40 -0600)]
convert random format to Format class. (#528)
tsteven4 [Mon, 30 Mar 2020 20:14:57 +0000 (14:14 -0600)]
convert nmea format to Format class. (#524)
tsteven4 [Fri, 27 Mar 2020 22:29:14 +0000 (16:29 -0600)]
migrate to travis-ci.com (#526)
* get qt installs working to load cache.
* update to travis-ci.com for github release build log links.
tsteven4 [Fri, 27 Mar 2020 20:19:40 +0000 (14:19 -0600)]
update Dockerfiles to use webengine instead (#525)
of webkit.
tsteven4 [Thu, 26 Mar 2020 22:05:36 +0000 (16:05 -0600)]
work around DG-100 getconfig issues (#519)
* work around dg-100 getconfig issues.
Don't issue the getconfig command on the DG-100. Different DG-100
devices seem to return different numbers of bytes, which leads
to checksum errors, which we treat as fatal. Before release
1.5.1 we didn't issue this command. It was apparently added because
it changed the status light to green on the DG-200.
* restore unintended whitespace change.
tsteven4 [Thu, 26 Mar 2020 16:56:57 +0000 (10:56 -0600)]
make some geojson member functions private. (#523)
tsteven4 [Thu, 26 Mar 2020 14:04:08 +0000 (08:04 -0600)]
convert geojson format to Format class. (#522)
* convert geojson format to Format class.
use gpsbable::File instead of QFile for input. This results in
better error messages.
use gpsbabel::File for output instead of gbfile.
* detect and log parser errors in geojson reader.
tsteven4 [Mon, 23 Mar 2020 17:20:35 +0000 (11:20 -0600)]
fix gtm writer issue with empty tracks. (#521)
This format expects one track style entry for each tracklog entry
with the tracklog flag set. If the tracklog flag is set it indicates the
start of a new track. Each tracklog entry represents a point.
Thus, it is not possible to represent a track without any points in this
format.
This change prevents the writing of track style entries for tracks that
don't have any points.
Previously, this could cause counts from test-all in the category
"tests without error but with unexpected output" if the refernce file
had tracks with no points.
GPSBabel [Thu, 19 Mar 2020 01:34:54 +0000 (20:34 -0500)]
Merge pull request #518 from gpsbabel/kmlfencepost
Let KML <TimeSpan> interpolation not count the ending fencepost
tsteven4 [Wed, 18 Mar 2020 18:50:04 +0000 (12:50 -0600)]
modernize radius filter ... (#511)
* modernize radius filter ...
and fix a memory leak when maxcount option discards wpts.
* radius loop safety.
* allow any Comparable with Waypoint/Route List sort.
* use static_cast instead of reinterpret_cast to
recover original type from void*.
tsteven4 [Wed, 18 Mar 2020 13:13:05 +0000 (07:13 -0600)]
CLI renamed to gpsbabel on all builds. (#520)
This chases some lose ends from
23379e741bf98603a5737e6f36422b753fc4bbdb
Robert Lipe [Mon, 16 Mar 2020 10:06:27 +0000 (05:06 -0500)]
Suspend uploading to transfer.sh. Sites refer to it as "now broken" and
"pending sale". My own testing shows that it saturates all the sockets for
a connection and dies with zero bytes transferred. Build server is about the
same.
This is a mechanical side-port of
33085422627563885c59e60d47d1c9085f48e9a4
which went to the trunk instead of the branch, wheree it'sn needed. Same code
Robert Lipe [Mon, 16 Mar 2020 09:47:25 +0000 (04:47 -0500)]
Suspend uploading to transfer.sh. Sites refer to it as "now broken" and
"pending sale". My own testing shows that it saturates all the sockets for
a connection and dies with zero bytes transferred. Build server is about the
same
Robert Lipe [Fri, 13 Mar 2020 08:18:07 +0000 (03:18 -0500)]
Fix generated IGC file to refelect recent change in our KML reader.
GPSBabel [Fri, 13 Mar 2020 05:48:44 +0000 (00:48 -0500)]
Merge pull request #514 from tsteven4/simplifyopt3
optimize simplify filter.
Robert Lipe [Fri, 13 Mar 2020 05:35:53 +0000 (00:35 -0500)]
Dont count ending fencepost when interpolating TimeSpan in KML reader.
Robert Lipe [Fri, 13 Mar 2020 05:21:39 +0000 (00:21 -0500)]
Make command line version lower case only - everywhere.
tsteven4 [Wed, 26 Feb 2020 01:53:32 +0000 (18:53 -0700)]
optimize simplify filter.
drop unused member ordinal from xte struct. This, and changes in
the implementation of shuffle_xte,
result in a ~13% speed improvement for long routes.
use new/delete instead of *alloc/free.
provide initializers for all data members.
use strtol instead of atol.
update casting to c++.
tsteven4 [Mon, 24 Feb 2020 18:22:16 +0000 (11:22 -0700)]
make shape a subclass of Format. (#512)
* make shape a subclass of Format.
* correct type of 2nd param passed to SHPCreateSimpleObject
tsteven4 [Thu, 20 Feb 2020 14:53:15 +0000 (07:53 -0700)]
use initializer list to construct gpx tag hash. (#509)
tsteven4 [Thu, 20 Feb 2020 14:48:28 +0000 (07:48 -0700)]
update format specific handling. (#502)
* update format specific handling.
Format specific allocate, copy, destroy functions use new/delete for
underlying data management. Use brace intitializers for underlying
data. Previous xmalloc/xcalloc and xfree were used.
Format specific copy functions use copy constructor of underlying data.
Format specific copy functions have a const source.
Format specific functions use static_cast instead of c-style casts.
This helps avoid casting away const accidentally.
When possible, assign the result of fs_chain_find to a const pointer.
Eliminate corruption of global lists by AN1 writer which was modifying
format specific data. This also simplifies memomry management and
fixes a double delete.
Fix const correctness issues with an1 symbol lookup.
Correct an1 symbol lookup to avoid dependency on structure padding.
Catch make-an1sym.pl with an1sym.h.
* use reinterpret_cast w/ fs_chain_add fs_chain_find ...
instead of c-style casts.
* make format_specifc_data a base class
and the various flavors derived classes.
* use a QList for format_specific_data chains.
* split format specific defines ...
use reinterpret_cast to downcast format_specific_data. dynamic_cast
is noticeably slower.
* add new formspec.h file.
* create FormatSpecificDataList class.
rename format specific related items.
* safety check for formspec nullptr function ptrs.
* replace format specific function pointers
with pure virtual clone function and dtor.
tsteven4 [Wed, 19 Feb 2020 20:35:59 +0000 (13:35 -0700)]
extend travis cache expiration date. (#510)
Robert Lipe [Sun, 16 Feb 2020 06:30:23 +0000 (00:30 -0600)]
More thoroughly hide clearly broken code that should exist only on a branch
that seeped into master when I added an epmpty file.
Robert Lipe [Sun, 16 Feb 2020 05:04:59 +0000 (23:04 -0600)]
Remove debugging.
Robert Lipe [Sun, 16 Feb 2020 05:03:24 +0000 (23:03 -0600)]
Delete debuging from yahoo.
Robert Lipe [Sun, 16 Feb 2020 04:55:38 +0000 (22:55 -0600)]
Something empty to force a codacy push.
Robert Lipe [Sun, 16 Feb 2020 04:55:00 +0000 (22:55 -0600)]
Merge branch 'master' of https://github.com/gpsbabel/gpsbabel
tsteven4 [Sat, 15 Feb 2020 22:37:45 +0000 (15:37 -0700)]
retire route_head_alloc(). (#507)
tsteven4 [Sat, 15 Feb 2020 19:26:44 +0000 (12:26 -0700)]
reference file relocation. (#506)
move geocaching.loc into reference directory.
use ${REFERENCE} to find reference files. not reference. not nothing.
Ralf Horstmann [Fri, 14 Feb 2020 20:09:38 +0000 (21:09 +0100)]
Implement GCID parsing in unicsv and extend ID to 64bit (#501)
* Implement GCID parsing in unicsv and extend ID to 64bit
This reimplements the parser and adds some test cases. The test
cases have been validated with several online converters, so this
hopefully works better than the previous implementation.
This also fixes an endless loop that afl managed to trigger.
* Fix clazy warning in unicsv
* Add GC-ID test cases, documentation, int parsing
- Explicitly do the integer parsing with base 10, otherwise hex
values and octal values would be accepted with 0x and 0 prefix.
- Add testcases that cover GC-ID parsing, including some invalid cases
- Unify the terminology (GC-Code vs GC-ID)
- Add examples to the unicsv documentation showing that both GC-ID
and GC-Code are accepted
tsteven4 [Thu, 13 Feb 2020 14:51:34 +0000 (07:51 -0700)]
warning fixes (#505)
* fix some qt deprecations and a warning.
* fix fixes.
* fix comment
tsteven4 [Wed, 12 Feb 2020 18:01:53 +0000 (11:01 -0700)]
use standard bionic image for travis coverage build. (#504)
Ralf Horstmann [Wed, 12 Feb 2020 16:19:01 +0000 (17:19 +0100)]
Some more fixes for issues found by afl/asan (#500)
* Fix uninitialized warning in lowranceusr
* Fix stack buffer overlow in lowranceusr
%15.10f may produce more characters than what fits into the
buffer of 32 bytes. Use std::isnan to avoid the sprintf.
==
2133227==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff9bab5b20 at pc 0x7fc83fd95865 bp 0x7fff9bab57e0 sp 0x7fff9bab4f70
WRITE of size 38 at 0x7fff9bab5b20 thread T0
#0 0x7fc83fd95864 in vsprintf (/lib64/libasan.so.5+0x9e864)
#1 0x7fc83fd95d1e in sprintf (/lib64/libasan.so.5+0x9ed1e)
#2 0x767bbb in lowranceusr_parse_waypt /home/gpsbabel/gpsbabel.git/lowranceusr.cc:813
#3 0x77be54 in lowranceusr_parse_waypts /home/gpsbabel/gpsbabel.git/lowranceusr.cc:1116
#4 0x781151 in data_read /home/gpsbabel/gpsbabel.git/lowranceusr.cc:1658
#5 0xc7ac71 in run /home/gpsbabel/gpsbabel.git/main.cc:339
#6 0x4cdd62 in main /home/gpsbabel/gpsbabel.git/main.cc:707
#7 0x7fc83f29d1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#8 0x4cef7d in _start (/home/gpsbabel/gpsbabel.git/gpsbabel+0x4cef7d)
* Ensure string is terminated mps_readstr in mapsource
When EOF or buffer limit is reached, the return buffer might not be
zero-terminated. So add termination at the end of the buffer and read
max sz - 1 bytes from file instead of sz bytes.
==
2145172==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd2ba34e00 at pc 0x7f005812dbbd bp 0x7ffd2ba34860 sp 0x7ffd2ba34008
READ of size 1028 at 0x7ffd2ba34e00 thread T0
#0 0x7f005812dbbc (/lib64/libasan.so.5+0x67bbc)
#1 0x557c62 in QString::fromUtf8(char const*, int) /usr/include/qt5/QtCore/qstring.h:572
#2 0x557c62 in QString::operator=(char const*) /usr/include/qt5/QtCore/qstring.h:706
#3 0x557c62 in mps_waypoint_r /home/gpsbabel/gpsbabel.git/mapsource.cc:571
#4 0x55edd4 in mps_read /home/gpsbabel/gpsbabel.git/mapsource.cc:1675
#5 0xc7adb1 in run /home/gpsbabel/gpsbabel.git/main.cc:339
#6 0x4ce082 in main /home/gpsbabel/gpsbabel.git/main.cc:707
#7 0x7f005766c1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#8 0x4cf29d in _start (/home/gpsbabel/gpsbabel.git/gpsbabel+0x4cf29d)
Address 0x7ffd2ba34e00 is located in stack of thread T0 at offset 1344 in frame
#0 0x556e8f in mps_waypoint_r /home/gpsbabel/gpsbabel.git/mapsource.cc:507
This frame has 6 object(s):
[48, 56) 'wptdesc' (line 538)
[80, 88) '<unknown>'
[112, 120) '<unknown>'
[144, 152) '<unknown>'
[176, 276) 'tbuf' (line 508)
[320, 1344) 'wptname' (line 509) <== Memory access at offset 1344 overflows this variable
* Fix off-by-one list access in pcx reader
* Prevent stack based buffer overflow in gdb reader
* Prevent global buffer overflow in garmin_fit
The message_def array is 16 bytes long, make sure local_id stays
within range, same as in other places in garmin_fit.
Found by afl which managed to create a call to fit_parse_data_message
with a header value of 0x1f:
==
2927747==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000010a3bd8 at pc 0x000000a91bba bp 0x7ffd82584a90 sp 0x7ffd82584a80
READ of size 4 at 0x0000010a3bd8 thread T0
#0 0xa91bb9 in fit_parse_data /home/gpsbabel/gpsbabel.git/garmin_fit.cc:549
#1 0xa92ae3 in fit_parse_data_message /home/gpsbabel/gpsbabel.git/garmin_fit.cc:821
#2 0xa92ae3 in fit_parse_record /home/gpsbabel/gpsbabel.git/garmin_fit.cc:864
#3 0xa92ae3 in fit_read /home/gpsbabel/gpsbabel.git/garmin_fit.cc:884
#4 0xc7cdb1 in run /home/gpsbabel/gpsbabel.git/main.cc:339
#5 0x4ce142 in main /home/gpsbabel/gpsbabel.git/main.cc:707
#6 0x7f4f3b2651a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#7 0x4cf35d in _start (/home/gpsbabel/gpsbabel.git/gpsbabel+0x4cf35d)
tsteven4 [Sun, 9 Feb 2020 19:36:54 +0000 (12:36 -0700)]
Rework interpolate filter, retire some magic numbers. (#498)
* rewrite interpolate filter.
What started out as an investigation of a clang-tidy warning about
a floating point loop counter (FloatLoopCounter, cert-flp30-c)
turned into this.
Use integer loop counters.
Use a variable step size, that is constant for each span, to meet the
constraint of no interval > limit.
Previously steps of the limit size were used leaving the last step in
a span of a different likely shorter size.
Be defensive about user input and track/route input, no more infinite
loops for negative time limits.
Support milliseconds.
Reduce duplication.
Enhance test to more easily verify interpolation steps.
More efficient route list maniupulation.
Correct documentation.
Correct signed literals use with the unsigned argtype.
This does reiterate, but not fix, the deficiency in route_head copying
that recently came up where new members of route_head are not copied.
* correct test to use long long format for TIMET_TIME_MS.
* Eliminate some magic numbers for unit conversion.
Previously the conversion factor for meters to feet was inaccurate. Correcting
this caused a couple kml test cases to change.
The ozi test was problematic, an altitiude was provided that endend in
0.5 feet, and was printed out rounded to feet. A one bit error in the
mantissa of the double involved in the round trip to meters could change
the rounding result. To fix this the ozi writer was changed to print
track altitudes to a tenth of a foot. This matches an ozi track file found in
the wild as well as our own ozi track sample.
The classic-2 test involving gnuplot.style printed altitude to one millonth
of a foot, i.e. 0.3 micrometers! The gnu plot style was changed to print
to the thousandth of a foot, i.e. 0.3 millimeters.
Ralf Horstmann [Sun, 9 Feb 2020 17:02:34 +0000 (18:02 +0100)]
Some fixes for issues found with afl and address sanitizer (#499)
* Fix off-by-one in nmea reader
Found with afl and address sanitizer:
AddressSanitizer:DEADLYSIGNAL
=================================================================
==
2615627==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f54eaa53683 bp 0x7ffd187eed00 sp 0x7ffd187ee4b8 T0)
==
2615627==The signal is caused by a READ memory access.
==
2615627==Hint: address points to the zero page.
#0 0x7f54eaa53682 in QString::chop(int) (/lib64/libQt5Core.so.5+0x13c682)
#1 0x5e8d7f in gpgsa_parse /home/gpsbabel/gpsbabel.git/nmea.cc:744
#2 0x5e8d7f in nmea_parse_one_line /home/gpsbabel/gpsbabel.git/nmea.cc:1021
#3 0x5f0b6f in nmea_read /home/gpsbabel/gpsbabel.git/nmea.cc:1096
#4 0xc7e483 in run /home/gpsbabel/gpsbabel.git/main.cc:339
#5 0x4ced15 in main /home/gpsbabel/gpsbabel.git/main.cc:707
#6 0x7f54ea3f71a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#7 0x4cffdd in _start (/home/gpsbabel/gpsbabel.git/gpsbabel+0x4cffdd)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib64/libQt5Core.so.5+0x13c682) in QString::chop(int)
==
2615627==ABORTING
* Fix heap buffer overflow in igc reader
In gbfgetstr(), when file->buff contains exactly file->buffsz
characters including null termination, there is no room to
append another character with strcat() in igc.cc
Found by afl with address sanitizer:
==
2082077==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x611000001f40 at pc 0x7f5a4e0da6cd bp 0x7ffd14ffe040 sp 0x7ffd14ffd7e8
WRITE of size 2 at 0x611000001f40 thread T0
#0 0x7f5a4e0da6cc (/lib64/libasan.so.5+0x9b6cc)
#1 0x7327cf in data_read /home/gpsbabel/gpsbabel.git/igc.cc:334
#2 0xc7a3c1 in run /home/gpsbabel/gpsbabel.git/main.cc:339
#3 0x4cddf2 in main /home/gpsbabel/gpsbabel.git/main.cc:707
#4 0x7f5a4d5e51a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#5 0x4cf00d in _start (/home/gpsbabel/gpsbabel.git/gpsbabel+0x4cf00d)
0x611000001f40 is located 0 bytes to the right of 256-byte region [0x611000001e40,0x611000001f40)
* Fix endless loop in mapsource
The loop around gbfread needs a check for eof, otherwise it
may never terminate with special input created by afl.
tsteven4 [Thu, 6 Feb 2020 23:46:06 +0000 (16:46 -0700)]
add address sanitizer, undefined behavior sanitizer, clazy to CI (#497)
* enhance travis tools
These are run under ubuntu eoan to get tools close to the
bleeding edge.
add address sanitizer
add undefined behavior sanitizer
add clazy
* fix clazy warning ...
now that we know travis catches it.
tsteven4 [Thu, 6 Feb 2020 01:45:52 +0000 (18:45 -0700)]
miscellaneous cleanups (#496)
* msvc, resharper fixes
Some "Qualifier is redundant"
"Redundant empty declaration"
"Redundant empty statement"
* restore missing comment
* various corrections ...
clazy clang-range-loop
some casting that confuse clang-tidy google-readability-casting
tsteven4 [Wed, 5 Feb 2020 19:47:03 +0000 (12:47 -0700)]
use rounding when interpolating time in arcdist filter. (#495)
eliminate uneccessary casting away of const.
reduce variable scope.
tsteven4 [Wed, 5 Feb 2020 18:52:31 +0000 (11:52 -0700)]
reimplement nmea waypoint status tracking. (#494)
62ae2fadb replaced waypoint status tracking based on Queues with
a derived class of Waypoint. This has proven problematic, see
https://github.com/gpsbabel/gpsbabel/pull/491
This PR implements the waypoint status stracking using the extra_data
member of Waypoint instead of using a dervied class.
tsteven4 [Wed, 5 Feb 2020 18:44:54 +0000 (18:44 +0000)]
fix stack buffer overflow errors in igc reader.
These were discoverd by gcc 9.2.1 address sanitizer.
They were introduced in
24195b5c4. The [ conversion specifier
always stores a null character in addition to the characters matched
(so the argument array must have room for at least width+1 characters)
tsteven4 [Tue, 4 Feb 2020 23:20:19 +0000 (16:20 -0700)]
re-implement gpx version handling. (#488)
Clean up data members related to version information.
Avoid casting string literals to (non-const) char*s.
Chris Mayo [Tue, 4 Feb 2020 20:31:39 +0000 (20:31 +0000)]
fix removal of tomtom test temporary ov2 file (#492)
tsteven4 [Tue, 4 Feb 2020 16:31:45 +0000 (09:31 -0700)]
relocate no output format display routine. (#486)
* relocate no output format display routine.
waypt_disp() is used by main when no output format is specified.
This moves that routine from waypt.cc to main.cc.
* clean up exit from main.
don't leave the global_waypoint_list lying around.
return from main instead of calling exit.
tsteven4 [Tue, 4 Feb 2020 13:07:36 +0000 (06:07 -0700)]
xcsv TIMET_TIME, TIMET_TIME_MS fix for the last fix. (#490)
* xcsv TIMET_TIME, TIMET_TIME_MS fix for the last fix.
e483407cf recently made a "fix" to TIMET_TIME_MS output. Unfortunately
it used a non-standard strftime specifier. While this worked on
linux systems it crashed with MSVC.
This removes strftime processing from TIMET_TIME_MS output. This makes
TIME_TIME, TIMET_TIME_MS analogous. Also input and output are
invertbile. Note that the documentation for these fields never mentioned
strptime or strftime, but says the are long intergers requiring long
integer printf conversions.
* Fix TIMET_TIME, TIMET_TIME_MS documentation.
These have been converted to 64 bit values to prepare for 2038.
* update style files for 64bit TIMET_TIME, TIMET_TIME_MS.
tsteven4 [Sun, 2 Feb 2020 19:08:40 +0000 (12:08 -0700)]
Qt5127 (#489)
* update to Qt 5.12.7
switch to online Qt installer.
Note the latest Qt online installer, 3.2.1, can crash on macos.
https://bugreports.qt.io/projects/QTIFW/issues/QTIFW-1592
For this reason we use the previous installer on macos.
* add missing online install script.
* update more travis install scripts.
* also switch Qt 5.9 builds to 5.9.9.
make install target optional in install-qt-online.
* fix linux install scripts, enable Qt archive
* add new installer dependencies.
* fix travis linux install scripts some more.
tsteven4 [Fri, 31 Jan 2020 17:56:02 +0000 (10:56 -0700)]
Fix memory leak in lowranceusr version 4 writer. (#487)
* fix memory leak in lowranceusr version 4 writer.
memory was still reachable, due to global pointer it wasn't lost.
* fix include.
tsteven4 [Thu, 30 Jan 2020 18:06:25 +0000 (11:06 -0700)]
convert xcsv format to sub-class of Format. (#481)
* convert xcsv format to sub-class of Format.
* move XcsvStyle functions inside class.
* Unnest XcsvStyle.
* remove redundant qualifiers.
tsteven4 [Thu, 30 Jan 2020 17:30:37 +0000 (10:30 -0700)]
clang-tidy modernize-use-auto, part 2, but (#485)
* clang-tidy modernize-use-auto, part 2, but
only on:
Message: use auto when initializing with a cast to avoid duplicating the type name
not on:
Message: use auto when initializing with new to avoid duplicating the type name
Message: use auto when initializing with a template cast to avoid duplicating the
Before running clang-tidy gbfile.h was changed to replace the macro definition of
gbfopen_le, gbfgetuint32, gbfgetuint16, gbfputuint16, gbfputuin32 with inline
function definitions. Without this change the application of modernize-use-auto
made it difficult to recognize the type of the result. Note this change has merit
of it's own,
see https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-macros
This was run with clang-tidy from llvm version 8. It generate serveral
compilation errors that will be fixed by hand in the next commit.
* fix errors introduced by clang-tidy modernize-use-auto.
These errors are of the form:
error: variable 'myvar' declared with deduced type 'auto *' cannot appear in its own initializer
They arose from patterns like:
mytype* myvar = (mytype*) xcalloc(1, sizeof(*myvar));
which clang-tidy changed to
auto* myvar = (mytype*) xcalloc(1, sizeof(*myvar));
These were edited by hand to the form
auto* myvar = (mytype*) xcalloc(1, sizeof(mytype));
At the same time, the order of the parameters in calls to
xcalloc was corrected.
tsteven4 [Wed, 29 Jan 2020 15:32:32 +0000 (08:32 -0700)]
clang-tidy modernize-use-auto, but (#483)
only on:
Message: use auto when initializing with new to avoid duplicating the type name
not on:
Message: use auto when initializing with a cast to avoid duplicating the type name
Message: use auto when initializing with a template cast to avoid duplicating the
The later two left me wondering what type I had, while it is obvious with the first
one. Some of this is due to our macro defines for gbffetuint*, gbfputuint*.
This required a edit of the fixes file produced by clang-tidy:
export PAT='with a template' A=3 B=3
vim -Nes "+g/${PAT}/.-${B},.+${A}d" '+w !tee' '+q!' ct8fixes.yaml > tmp1.yaml
export PAT='with a cast' A=2 B=3
vim -Nes "+g/${PAT}/.-${B},.+${A}d" '+w !tee' '+q!' tmp1.yaml > myfixes.yaml
rm ct8fixes.yaml
rm tmp1.yaml
tsteven4 [Tue, 28 Jan 2020 16:42:05 +0000 (09:42 -0700)]
eliminate const_cast from lowranceusr. (#480)
tsteven4 [Tue, 28 Jan 2020 02:08:51 +0000 (19:08 -0700)]
rework gathering of serialization information. (#479)
The existing method broke encapsulation to generate the combined
list of regular and style based formats. It required access to
xcsv_vecs, which is only present in LegacyFormats. Until recently
it also required access to xcsv_file.
The existing method also leaked memory, although the use case was
such that the program always exited shortly thereafter.
All these issues are resolved during unification by gathering all the
necessary information and passing that on to serialization. This
information is gathered from different places for regular and style
based formats.
tsteven4 [Mon, 27 Jan 2020 22:00:17 +0000 (15:00 -0700)]
Improve xcsv modularization, fix some xcsv end cases. (#476)
* Improve xcsv modularization, fix some xcsv end cases.
Add a test for various textual outputs from main. Some of these are
for the user, and some of these are primarly for passing information
to the doc or the GUI. While the reference files will have to change
anytime we add/delete a filter or format, or anytime a filter or format
has an arugment change, this test prevents bugs from unintentionally
changing the information passed to the GUI. As the GUI has no automated
test those types of bugs are difficult to find.
Enhance csv test to cover more end cases with the xcsv format. Historically
these cases have involved a series of xcsv format operations. These operations
may be using internal style files or passed style files. These operations may
or may not involve postional arugments on the command line. Some of these end
cases represented bugs previous to this PR, e.g. a series of input operations
where a xcsv format using an internal style is followed by an xcsv format using
a passsed style file.
Refactor XcsvFile, splitting sytle information into XcsvStyle. This allows
xcsv_file to be private. A XcsvStyle object is returned to Vecs by
xcsv_read_internalstyle that can Vecs can parse to build vectors containing
the real formats and the style based formats. This also eliminates bugs as
we build a new XcsvFile object every time we parse an external or internal
style file so we don't have any accidental dependiencies on previous operations.
Some other xcsv bugs are fixed:
DATUM was always ignored in a style file.
#474 xcsv style derived formats may have wrong GUI and/or CLI capability.
Behavoir now matches the document, which is likely not to be what some of
the style file authors intended! E.g. should gpsdrivetrack really be
working with waypoints as they do after this PR and as is documented,
or was the accidental operation with tracks desired?
Use gpsbabel::textstream in xcsv.
Stay tuned for xcsv to become a real Format as opposed to a LegacyFormat.
* try to get serialization test to work across OSs.
* disable serialization test under valgrind ...
and disable usage test on all platforms.
we have known leaks in Vecs::sort_and_unify.
usage test fails on windows under appveyor, the sed line doesn't
seem to work.
* ok, twos tests have the executable name embedded.
* Limit # of waypoints holux writer tries to write
so the writer doesn't write passed the end of the write buffer.
* eliminate unnecessary const_cast.
Ralf Horstmann [Mon, 27 Jan 2020 21:24:04 +0000 (22:24 +0100)]
Convert mynav to Format sub-class (#472)
* Convert mynav to Format sub-class
While there, switch to gpsbabel::File, QTextStream, and introduce
enum for line type.
* Switch mynav to TextStream
* Include cleanup in mynav
* Correct includes, add link to spec for mynav format
tsteven4 [Mon, 27 Jan 2020 21:09:13 +0000 (14:09 -0700)]
Delete unused cet bits. (#469)
Try to consistently use Latin1 for garmin format.
tsteven4 [Mon, 27 Jan 2020 19:22:23 +0000 (12:22 -0700)]
modify format access to waypts via global list. (#478)
As a rule writers should not modify waypoints on the global list.
One way this can happen is if the writer uses the global waypoint
list, global_waypoint_list. Via the list pointers to non-const
Waypoints can be accessed. The three writers that use the
global_waypoint_list all did not modify any waypoints, but it was not obvious.
This PR makes it obvious by getting const Waypoint pointers from the list.
This required some const correctness corrections in these writers.
As a rule readers should not modify waypoints they didn't add to the
global list.
One way this can happen is if the reader uses the global waypoint list.
One reader was inapproprieately modifying waypoints on the global list.
While this is OK for waypoints it added, it is not OK for any waypoints
that were added by other readers. This PR fixes a bug where the
netsumbler reader, intending to modify waypoints it added to the list,
actually modified all waypoints on the list.
tsteven4 [Sun, 26 Jan 2020 15:26:58 +0000 (08:26 -0700)]
refactor height filter to appease cppcheck & MSVC (#473)
* refactor heightgrid to appease cppcheck.
With newer versions (somwhere after 1.82) of cppcheck analyzing
height.cc took an excessive amount of time.
By making these variables private static class members instead of
member function static variables we avoid the cppcheck issues.
* tweak height to work around MSVC 2017 error.
and hopefully MSVC 2015 error as well.
* don't include cstdint within class definition.
It can lead to compile failures. This was done in heightgrid.h,
but the include guards in cstdint hid the error.
tsteven4 [Sun, 26 Jan 2020 15:04:36 +0000 (08:04 -0700)]
fix some xcsv bugs. (#477)
These led to non-sensical motoactv files in test-all. These
non-sensical files lead to the discovery of a holux write passed
end of buffer bug.
1.
fea062ee7 writtime expects a strftime format specification.
When writing XT_TIMET_TIME_MS with writtime the strpftime format
specification ("%s") that was previously used was replaced by a printf
format specification ("%ld"). Thus the twelve hour clock followed by
a 'd' character was printed instead of the number of seconds since the Epoch.
2.
172073cdb When intending to print the field encloser the record
delimiter printed instead.
Robert Lipe [Sun, 26 Jan 2020 10:42:29 +0000 (04:42 -0600)]
Checkpoint yahoo work. This gets messy because xml_format really wants C pointers to member functions so we'll probably have to shim in an instance and a fake 'this'.
tsteven4 [Sat, 25 Jan 2020 16:34:59 +0000 (09:34 -0700)]
gpsbabel::textstream now accepts open mode flags (#475)
Previously only an open mode flag was accepted, now a combination
of flags will be accepted.
tsteven4 [Wed, 22 Jan 2020 01:24:11 +0000 (18:24 -0700)]
update codacy coverage tool. (#471)
tsteven4 [Wed, 22 Jan 2020 00:11:34 +0000 (17:11 -0700)]
try to get codacy cppcheck running without height.cc (#470)
Ralf Horstmann [Tue, 21 Jan 2020 22:10:34 +0000 (23:10 +0100)]
Convert ggv_bin format to sub-class of Format (#462)
* Convert ggv_bin format to sub-class of Format
* Add ggv_bin helpers as class member functions
* Style improvements in ggv_bin
tsteven4 [Tue, 21 Jan 2020 15:32:09 +0000 (08:32 -0700)]
Don't lie to mkshort about utf8. (#468)
Pass a flag indicating utf8 on every call to mkshort, instead of
setting it up in the handle. This is much more likely to be correct
as the string and the flag are passed together. The old method was
often incorrect as it was based on global_opts.charset, which was
often unrelated to the string that was passed to mkshort.
This also resolved an apparent bug in psitrex. It was thought
that passing a nullptr to mkshort was a bug, but this results in
the result being generated from the default name. It is assumed
that this is what was originally intended, and this was never a bug.
tsteven4 [Tue, 21 Jan 2020 01:25:22 +0000 (18:25 -0700)]
Drop backup/restore of wpts, rtes, trks in main. (#467)
PR #459,
df03a17, eliminated cet_covert_strings from main.cc.
Thus there is no need to backup and restore waypoints, routes,
and tracks when running a format writer.
For the same reason we no longer need to push and pop verbose
status when running a format writer or display the waypoints in the
case that no format writer was used.
tsteven4 [Tue, 21 Jan 2020 00:10:30 +0000 (17:10 -0700)]
fix RouteList::copy() (#466)
which failed to copy some members of each route, specifically
line_color, line_width, session.
tsteven4 [Mon, 20 Jan 2020 18:01:12 +0000 (11:01 -0700)]
remove HAVE_LINUX_HID support from builds. (#465)
We haven't used this for some time.
tsteven4 [Mon, 20 Jan 2020 17:09:52 +0000 (10:09 -0700)]
Datetime optimization (#439)
* Optimize performance of DateTime.
Prefer Qt::UTC TimeSpec for storing creation_time.
This avoids very significant performance hits from converting
to/from Qt::LocalTime, which involve DST calculations as well
as the usual offsets.
Test suite with this commit runs at 63% of wall-clock time of the
baseline (time ./testo)!
* remove obsolete fromTime_t and use Qt::UTC.
* Delete obsolete operators and methods of DateTime.
* document motivation for Qt::UTC as default timespec.
Modify Waypoint::SetCreationTime so it can be used with seconds, milliseconds,
or both operands. This method is implemented without resetting the
Qt::TimeSpec. It will be efficient if the existing TimeSpec is
Qt::UTC as set up by gpsbabel::DateTime default constructor.
Ralf Horstmann [Sun, 19 Jan 2020 22:28:12 +0000 (23:28 +0100)]
Add OpenBSD support to qmake project (#464)
* Add OpenBSD support to qmake project
* Set HAVE_LINUX_HID only on Linux in CMakeLists.txt
tsteven4 [Sat, 18 Jan 2020 21:46:24 +0000 (14:46 -0700)]
eliminate cet usage in destinator, igo8, mmo. (#463)
* eliminate cet usage in igo8 format.
added test to verify written header.
This test requires spaces to be embedded within option strings.
testo had to be modififed to preserve these embedded spaces.
* eliminate cet usage in destinator.
* eliminate cet usage in mmo.
This also fixes some apparent encoding/decoding bugs, although
our understanding of this binary format is likely incomplete.
* use smart pointer with encoders/decoders.
* fix bad resolution of merge conflict.
GPSBabel [Sat, 18 Jan 2020 17:15:04 +0000 (11:15 -0600)]
Merge pull request #453 from ra1fh/ggv-bin-int-overflow
Prevent negative len in ggv_bin_read_bytes.
tsteven4 [Sat, 18 Jan 2020 16:04:07 +0000 (09:04 -0700)]
retire cet_convert_strings (#459)
* prepare to eliminate char strings from garmin_fs_t.
* retire cet_covnert_strings
The only use was for garmin specific data(gmsd).
gmsd is migrated from char strings to QStrings,
and any necessary conversions are handled within the formats using
gmsd.
This takes main out of the string conversion business.
* fix gmsd related memory leaks.
and eliminate a little back and forth between
char strings and QStrings.
csv_stringtrim has 3 signatures:
1. char*,char*,int returning char* that must be free'd.
2. QString,QString returning QString
3. QString,QString,int returing QString
We may want to consider replacing 2. with 3. and a default for
the 3rd argument.
tsteven4 [Fri, 17 Jan 2020 23:49:38 +0000 (16:49 -0700)]
clean up make icon doc. (#460)
and fix an old capitalization error in the document.
tsteven4 [Thu, 16 Jan 2020 02:25:00 +0000 (19:25 -0700)]
use QTextStream for garmin_txt format. (#458)